#include<stdio.h>
#include <sys/stat.h>
int main(){
    int res = chmod("./test.txt",0777);
    if(res != 0){
        printf("chmod error\n");
        return -1;
    }

    struct stat buff;
    res = stat("./test.txt",&buff);
    if(res != 0){
        printf("stat error\n");
        return -1;
    }

    printf("文件权限为：%o\n",buff.st_mode);
    printf("%d\n",S_ISREG(buff.st_mode));
    printf("\n");
  
    printf("修改成功\n");
}